from nonebot import on_command, CommandSession
from .enc_easy import encry

@on_command('md5')
async def md5s(session:CommandSession):
    va = session.get('va',prompt='need values')
    enc = encry()
    ret = enc.str_md5(va)
    await session.finish(ret)

@on_command('b64en')
async def b64en(session: CommandSession):
    va = session.get('va', prompt='need values')
    enc = encry()
    ret = enc.str_en_b64(va)
    await session.finish(ret)

@md5s.args_parser
async def _(session: CommandSession):
    stripped_arg = session.current_arg_text.strip()

    if stripped_arg:
        session.state['va'] = stripped_arg
    if not stripped_arg:
        session.pause('Values??')

    session.state[session.current_key] = stripped_arg



